package com.adam.springmvc.generator.mapper;

import com.adam.springmvc.generator.model.Course;
import com.adam.springmvc.generator.model.CourseExample;
import java.util.List;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.ResultMap;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

public interface CourseMapper {
    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table courses
     *
     * @mbg.generated Wed Aug 21 21:00:08 CST 2024
     */
    long countByExample(CourseExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table courses
     *
     * @mbg.generated Wed Aug 21 21:00:08 CST 2024
     */
    int deleteByExample(CourseExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table courses
     *
     * @mbg.generated Wed Aug 21 21:00:08 CST 2024
     */
    @Delete({
        "delete from courses",
        "where course_id = #{courseId,jdbcType=INTEGER}"
    })
    int deleteByPrimaryKey(Integer courseId);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table courses
     *
     * @mbg.generated Wed Aug 21 21:00:08 CST 2024
     */
    @Insert({
        "insert into courses (course_id, name, ",
        "description, start_date, ",
        "end_date, tutor_id)",
        "values (#{courseId,jdbcType=INTEGER}, #{name,jdbcType=VARCHAR}, ",
        "#{description,jdbcType=VARCHAR}, #{startDate,jdbcType=DATE}, ",
        "#{endDate,jdbcType=DATE}, #{tutorId,jdbcType=INTEGER})"
    })
    int insert(Course row);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table courses
     *
     * @mbg.generated Wed Aug 21 21:00:08 CST 2024
     */
    int insertSelective(Course row);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table courses
     *
     * @mbg.generated Wed Aug 21 21:00:08 CST 2024
     */
    List<Course> selectByExample(CourseExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table courses
     *
     * @mbg.generated Wed Aug 21 21:00:08 CST 2024
     */
    @Select({
        "select",
        "course_id, name, description, start_date, end_date, tutor_id",
        "from courses",
        "where course_id = #{courseId,jdbcType=INTEGER}"
    })
    @ResultMap("com.adam.springmvc.generator.mapper.CourseMapper.BaseResultMap")
    Course selectByPrimaryKey(Integer courseId);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table courses
     *
     * @mbg.generated Wed Aug 21 21:00:08 CST 2024
     */
    int updateByExampleSelective(@Param("row") Course row, @Param("example") CourseExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table courses
     *
     * @mbg.generated Wed Aug 21 21:00:08 CST 2024
     */
    int updateByExample(@Param("row") Course row, @Param("example") CourseExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table courses
     *
     * @mbg.generated Wed Aug 21 21:00:08 CST 2024
     */
    int updateByPrimaryKeySelective(Course row);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table courses
     *
     * @mbg.generated Wed Aug 21 21:00:08 CST 2024
     */
    @Update({
        "update courses",
        "set name = #{name,jdbcType=VARCHAR},",
          "description = #{description,jdbcType=VARCHAR},",
          "start_date = #{startDate,jdbcType=DATE},",
          "end_date = #{endDate,jdbcType=DATE},",
          "tutor_id = #{tutorId,jdbcType=INTEGER}",
        "where course_id = #{courseId,jdbcType=INTEGER}"
    })
    int updateByPrimaryKey(Course row);
}